<?
if(isset($_GET['keyword'])) $keyword=$_GET['keyword'];

	$keyword = trim($keyword);
	$keyword = strtolower($keyword);
	$keyword = mysql_escape_string($keyword);
	//echo $keyword;die;
	//echo $idtp;
	$pageSize = 60;
	$pageNum = 1;
    if (isset($_GET['pageNum'])==true) $pageNum = $_GET['pageNum'];
	// echo $keyword;die;
	$totalRows = 0;
	$sanpham=$t->get_phantrang_order($pageNum,$pageSize,$totalRows,"sanpham",-1,1,"and ten_$lang like '%$keyword%'");
?>

					<div class="product">
						<div class="url_top">
							<a href="<?=$rooturl?><?=$list['1']['alias'];?>.html"><?=$list['1']['ten_'.$lang];?></a> > 
                            <?=$list['8']['ten_'.$lang];?>
						</div>
						<div class="list_record">
							<ul>
								<?
									$i=0;
									while($row_sp=mysql_fetch_assoc($sanpham)){
									$sanpham_loai = $t->get_by_thutu("sanpham_loai",$row_sp['idloai'],1);
									$row_l=mysql_fetch_assoc($sanpham_loai);
									if($row_l['ten_'.$lang]=='') $row_l['ten_'.$lang]='-';
							
									$sanpham_chungloai = $t->get_by_thutu("sanpham_chungloai",$row_sp['idcl'],1);
									$row_cl=mysql_fetch_assoc($sanpham_chungloai);
									if($row_cl['ten_'.$lang]=='') $row_cl['ten_'.$lang]='-';
									
									$sanpham_root = $t->get_by_thutu("sanpham_root",$row_sp['idroot'],1);
									$row_root=mysql_fetch_assoc($sanpham_root);
									if($row_root['ten_'.$lang]=='') $row_root['ten_'.$lang]='-';
							
									$menu=$t->get_by_thutu("sanpham_menu",$row_sp['idmenu']);
									$row_menu=mysql_fetch_assoc($menu);
									if($row_menu['ten_'.$lang]=='') $row_menu['ten_'.$lang]='-';
										$i++;
										$images = explode(':*:',$row_sp['url_img']);
								?>
								<li <? if ($i==1 || $i%7==0) { echo "class='top'"; } ?>>
									<a title="<?=$row_sp['ten_'.$lang]?>" href="<?=$rooturl?><?=$list['15']['alias']?>/<?=convert($row_menu['ten_'.$lang])?>/<?=convert($row_root['ten_'.$lang])?>/<?=convert($row_chungloai['ten_'.$lang])?>/<?=convert($row_loai['ten_'.$lang])?>/<?=convert($row_sp['ten_'.$lang])?>-<?=$row_sp['id']?>.html">
										<img src="<?=getUrlThumbnail($images[0])?>" />
									</a>
									<br/>
									<a href="<?=$rooturl?><?=$list['15']['alias']?>/<?=convert($row_menu['ten_'.$lang])?>/<?=convert($row_root['ten_'.$lang])?>/<?=convert($row_chungloai['ten_'.$lang])?>/<?=convert($row_loai['ten_'.$lang])?>/<?=convert($row_sp['ten_'.$lang])?>-<?=$row_sp['id']?>.html">
										<?=$row_sp['code']?>
									</a>
									<br/>
									<?php if ($row_sp['gia'] == 0): ?>
					                    <span style="">Call 08 6652 9957</span>
					                <?php else: ?>
					                    <span style=""><?=number_format($row_sp['gia'],0,".",",")?></span>
					                <?php endif ?>
								</li>
								<?
									}
								?>
							</ul>
						</div>
					</div>
                    <div style="clear:both"></div>
                    <div class="showpageArea">
        <?php echo $t->pagesList2($rooturl.$_GET['a'].'.html?keyword='.$keyword,$totalRows,$pageNum,$pageSize,5); ?>
</div>
<div style="clear:both"></div>